package com.cnswhy.cloud.common.logging.uitls;

import com.cnswhy.cloud.common.logging.constant.MDCConstant;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;

import java.util.UUID;

public class MDCUtil {
    public static String getTraceId(){
        String traceId = MDC.get("trace");
        if(StringUtils.isBlank(traceId)){
            return UUID.randomUUID().toString().replaceAll("-", "");
        }
        return traceId;
    }
}
